unsigned long page[1024];
/* A copy of the pfn-to-mfn table frame list. */
- unsigned long *live_pfn_to_mfn_frame_list;
+ unsigned long *live_pfn_to_mfn_frame_list = NULL;
unsigned long pfn_to_mfn_frame_list[1024];
/* Live mapping of the table mapping each PFN to its current MFN. */
unsigned long mfn_to_pfn_table_start_mfn;
/* Live mapping of shared info structure */
- shared_info_t *live_shinfo;
+ shared_info_t *live_shinfo = NULL;
/* base of the region in which domain memory is mapped */
unsigned char *region_base = NULL;
/* A temporary mapping, and a copy, of the guest's suspend record. */
- suspend_record_t *p_srec;
+ suspend_record_t *p_srec = NULL;
/* number of pages we're dealing with */
unsigned long nr_pfns;
for ( j = 0; j < batch; j++ ){
if ( (pfn_type[j] & LTAB_MASK) == XTAB ){
DDPRINTF("type fail: page %i mfn %08lx\n",j,pfn_type[j]);
+printf("type fail: page %i mfn %08lx\n",j,pfn_type[j]);
continue;
}
goto out;
}
- printf("SUSPPPPPPPP flags %08lx shinfo %08lx eip %08lx esi %08lx\n",
+ printf("SUSPEND flags %08lx shinfo %08lx eip %08lx esi %08lx\n",
op.u.getdomaininfo.flags, op.u.getdomaininfo.shared_info_frame,
ctxt.cpu_ctxt.eip, ctxt.cpu_ctxt.esi );
xcio_error(ioctxt, "Suspend record is not in range of pseudophys map");
goto out;
}
-
+
/* Canonicalise each GDT frame number. */
for ( i = 0; i < ctxt.gdt_ents; i += 512 ) {
+ ctxt.gdt_frames[i], live_mfn_to_pfn_table[ctxt.gdt_frames[i]]);
if ( !translate_mfn_to_pfn(&ctxt.gdt_frames[i]) ) {
xcio_error(ioctxt, "GDT frame is not in range of pseudophys map");
goto out;
xcio_error(ioctxt, "Error when writing to state file (1)");
goto out;
}
- munmap(live_shinfo, PAGE_SIZE);
+
printf("Everything saved OK!\n");
out:
+
+ if ( live_shinfo ) munmap(live_shinfo, PAGE_SIZE);
+ if ( p_srec ) munmap(p_srec, sizeof(*p_srec));
+ if ( live_pfn_to_mfn_frame_list ) munmap(live_pfn_to_mfn_frame_list, PAGE_SIZE);
+ if ( live_pfn_to_mfn_table ) munmap(live_pfn_to_mfn_table, nr_pfns*4 );
+ if ( live_mfn_to_pfn_table ) munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024 );
+
if ( pfn_type != NULL ) free(pfn_type);
DPRINTF("Save exit rc=%d\n",rc);
return !!rc;
int i, nr_pages = (entries + 511) / 512;
struct desc_struct *vgdt;
+ vgdt = map_domain_mem(frames[0] << PAGE_SHIFT);
+ memset( vgdt + FIRST_RESERVED_GDT_ENTRY, 0,
+ NR_RESERVED_GDT_ENTRIES*8);
+
/* Check the new GDT. */
for ( i = 0; i < nr_pages; i++ )
{
}
/* Copy reserved GDT entries to the new GDT. */
- vgdt = map_domain_mem(frames[0] << PAGE_SHIFT);
memcpy(vgdt + FIRST_RESERVED_GDT_ENTRY,
gdt_table + FIRST_RESERVED_GDT_ENTRY,
NR_RESERVED_GDT_ENTRIES*8);
/* Try to validate page type; drop the new reference on failure. */
if ( unlikely(!alloc_page_type(page, type)) )
{
- DPRINTK("Error while validating pfn %08lx for type %08x\n",
- page_to_pfn(page), type);
+ DPRINTK("Error while validating pfn %08lx for type %08x. caf=%08x taf=%08x\n",
+ page_to_pfn(page), type,
+ page->u.inuse.count_info,
+ page->u.inuse.type_info);
put_page_type(page);
return 0;
}